﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using eProject_SEM3_SecurityServices.DataAccess;
using eProject_SEM3_SecurityServices.ObjectClass;
using System.Data;

namespace eProject_SEM3_SecurityServices.Bussiness
{
    public class BCustomerServices
    {
        DCustomerService dcs = new DCustomerService();
        public List<customerServices> getListCustomerService()
        {
             List<customerServices> listCustomerServices = null;
            if (dcs.getTableServices().Rows.Count > 0)
            {
                listCustomerServices = new List<customerServices>();
                foreach (DataRow row in dcs.getTableServices().Rows)
	            {
                    customerServices cs = new customerServices();
                    cs.ContractId = Convert.ToInt32(row["ContractId"]);
		            cs.ServiceName = row["serviceName"].ToString();
                    cs.CustomerName = row["customerName"].ToString();
                    cs.RegistryDay = row["RegistryDay"].ToString();
                    cs.StartDay = row["startDay"].ToString();
                    cs.EndDay = row["endDay"].ToString();
                    cs.NumberOfemployee = Convert.ToInt32(row["NumberOfemployee"]);
                    if (row["Status"].Equals(false))
                    {
                        cs.Status = "Pending";
                    }
                    else
                    {
                        cs.Status = "Seen";
                    }
                    
                    listCustomerServices.Add(cs);
	            }
            }
            return listCustomerServices;
        }
    }
}